#!/usr/bin/env python3
#-*- coding:utf-8 -*-

import os, sys, gettext
from tkinter import *
from tkinter.font import Font
from tkinter.ttk import *
#Usage:showinfo/warning/error,askquestion/okcancel/yesno/retrycancel
from tkinter.messagebox import *
#from tkinter import filedialog  #.askopenfilename()
#from tkinter import simpledialog  #.askstring()

class Application_ui(Frame):
    def __init__(self, master):
        super().__init__(master)
        self.master.title('Fitgirl Downlond')
        self.master.geometry('623x645')
        self.createWidgets()

    def createWidgets(self):
        self.top = self.winfo_toplevel()

        self.style = Style()

        self.style.configure('TFrame2.TLabelframe', font=('黑体',9))
        self.style.configure('TFrame2.TLabelframe.Label', font=('黑体',9))
        self.Frame2 = LabelFrame(self.top, text='下载状态：', style='TFrame2.TLabelframe')
        self.Frame2.place(relx=0.016, rely=0.698, relwidth=0.965, relheight=0.234)

        self.style.configure('TFrame1.TLabelframe', font=('黑体',9))
        self.style.configure('TFrame1.TLabelframe.Label', font=('黑体',9))
        self.Frame1 = LabelFrame(self.top, text='下载列表：', style='TFrame1.TLabelframe')
        self.Frame1.place(relx=0.016, rely=0.14, relwidth=0.965, relheight=0.544)

        self.btn_saveVar = StringVar(value='选择')
        self.style.configure('Tbtn_save.TButton', font=('宋体',9))
        self.btn_save = Button(self.top, text='选择', textvariable=self.btn_saveVar, command=self.btn_save_Cmd, style='Tbtn_save.TButton')
        self.btn_save.setText = lambda x: self.btn_saveVar.set(x)
        self.btn_save.text = lambda : self.btn_saveVar.get()
        self.btn_save.place(relx=0.867, rely=0.078, relwidth=0.107, relheight=0.052)

        self.txt_saveVar = StringVar(value='')
        self.txt_save = Entry(self.top, textvariable=self.txt_saveVar, font=('黑体',11))
        self.txt_save.setText = lambda x: self.txt_saveVar.set(x)
        self.txt_save.text = lambda : self.txt_saveVar.get()
        self.txt_save.place(relx=0.144, rely=0.078, relwidth=0.708, relheight=0.052)

        self.txt_IDMVar = StringVar(value='')
        self.txt_IDM = Entry(self.top, textvariable=self.txt_IDMVar, font=('黑体',11))
        self.txt_IDM.setText = lambda x: self.txt_IDMVar.set(x)
        self.txt_IDM.text = lambda : self.txt_IDMVar.get()
        self.txt_IDM.place(relx=0.144, rely=0.016, relwidth=0.708, relheight=0.052)

        self.btn_startVar = StringVar(value='开始')
        self.style.configure('Tbtn_start.TButton', font=('宋体',9))
        self.btn_start = Button(self.top, text='开始', textvariable=self.btn_startVar, command=self.btn_start_Cmd, style='Tbtn_start.TButton')
        self.btn_start.setText = lambda x: self.btn_startVar.set(x)
        self.btn_start.text = lambda : self.btn_startVar.get()
        self.btn_start.place(relx=0.321, rely=0.946, relwidth=0.146, relheight=0.048)

        self.btn_IDMVar = StringVar(value='选择')
        self.style.configure('Tbtn_IDM.TButton', font=('宋体',9))
        self.btn_IDM = Button(self.top, text='选择', textvariable=self.btn_IDMVar, command=self.btn_IDM_Cmd, style='Tbtn_IDM.TButton')
        self.btn_IDM.setText = lambda x: self.btn_IDMVar.set(x)
        self.btn_IDM.text = lambda : self.btn_IDMVar.get()
        self.btn_IDM.place(relx=0.867, rely=0.016, relwidth=0.107, relheight=0.052)

        self.Label2Var = StringVar(value='保存地址：')
        self.style.configure('TLabel2.TLabel', anchor='w', font=('宋体',9))
        self.Label2 = Label(self.top, text='保存地址：', textvariable=self.Label2Var, style='TLabel2.TLabel')
        self.Label2.setText = lambda x: self.Label2Var.set(x)
        self.Label2.text = lambda : self.Label2Var.get()
        self.Label2.place(relx=0.016, rely=0.091, relwidth=0.12, relheight=0.023)

        self.Label1Var = StringVar(value=' IDM地址：')
        self.style.configure('TLabel1.TLabel', anchor='w', font=('宋体',9))
        self.Label1 = Label(self.top, text=' IDM地址：', textvariable=self.Label1Var, style='TLabel1.TLabel')
        self.Label1.setText = lambda x: self.Label1Var.set(x)
        self.Label1.text = lambda : self.Label1Var.get()
        self.Label1.place(relx=0.015, rely=0.029, relwidth=0.124, relheight=0.023)

        self.btn_stopVar = StringVar(value='停止')
        self.style.configure('Tbtn_stop.TButton', font=('宋体',9))
        self.btn_stop = Button(self.top, text='停止', textvariable=self.btn_stopVar, command=self.btn_stop_Cmd, style='Tbtn_stop.TButton')
        self.btn_stop.setText = lambda x: self.btn_stopVar.set(x)
        self.btn_stop.text = lambda : self.btn_stopVar.get()
        self.btn_stop.place(relx=0.498, rely=0.946, relwidth=0.146, relheight=0.048)

        self.txt_dl_statusFont = Font(font=('黑体',11))
        self.txt_dl_status = Text(self.Frame2, font=self.txt_dl_statusFont)
        self.txt_dl_status.place(relx=0.017, rely=0.132, relwidth=0.967, relheight=0.801)
        self.txt_dl_status.insert('1.0','')

        self.txt_dl_listFont = Font(font=('黑体',11))
        self.txt_dl_list = Text(self.Frame1, font=self.txt_dl_listFont)
        self.txt_dl_list.place(relx=0.017, rely=0.057, relwidth=0.967, relheight=0.915)
        self.txt_dl_list.insert('1.0','')

    def retranslateUi(self):
        self.master.title(_('Fitgirl Downlond'))
        self.Frame2.configure(text=_('下载状态：'))
        self.Frame1.configure(text=_('下载列表：'))
        self.btn_save.setText(_('选择'))
        self.btn_start.setText(_('开始'))
        self.btn_IDM.setText(_('选择'))
        self.Label2.setText(_('保存地址：'))
        self.Label1.setText(_(' IDM地址：'))
        self.btn_stop.setText(_('停止'))

class Application(Application_ui):
    def __init__(self, master):
        super().__init__(master)
        tr = gettext.translation('lang', localedir='i18n', languages=['en'], fallback=True)
        tr.install()
        self.retranslateUi()

    def btn_save_Cmd(self, event=None):
        #TODO, Please finish the function here!
        pass

    def btn_start_Cmd(self, event=None):
        #TODO, Please finish the function here!
        pass

    def btn_IDM_Cmd(self, event=None):
        #TODO, Please finish the function here!
        pass

    def btn_stop_Cmd(self, event=None):
        #TODO, Please finish the function here!
        pass

if __name__ == "__main__":
    top = Tk()
    Application(top).mainloop()

